<% javascript "swfupload/swfupload.js", "swfupload/swfupload.swfobject.js",
							"swfupload/swfupload.queue.js", "swfupload/fileprogress.js", "swfupload/handlers.js" %>
<% stylesheet "swfupload.css" %>

<script type="text/javascript">
		var swfu;
		var assetable_type = "<%= model.class.to_s %>";
		var assetable_id = "<%= model.id %>";
		var upload_path = "<%= new_attachment_path_with_session_information %>";
	
		function init_swfupload() {
			swfu = new SWFUpload({
				// Backend settings
				upload_url: upload_path,
				post_params: {"assetable_type" : assetable_type, "assetable_id" : assetable_id},
				file_post_name: "photo_file",

				// Flash file settings
				file_size_limit : "10 MB",
				file_types : "*.jpg;*.jpeg;*.png;*.gif",			// or you could use something like: "*.doc;*.wpd;*.pdf",
				file_types_description : "All Images",
				file_upload_limit : 10,
				file_queue_limit : 0,

				// The event handler functions are defined in handlers.js
				//swfupload_loaded_handler : swfUploadLoaded,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete,	// Queue plugin event

				// Button Settings
				button_image_url : "/images/manage/button_add_foto.gif",
				button_placeholder_id : "spanButtonPlaceholder",
				button_width: 170,
				button_height: 32,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,
				
				// Flash Settings
				flash_url : "/swf/swfupload.swf",

				custom_settings : { 
					progressTarget : "divFileProgressContainer",
    		  cancelButtonId : "btn_cancel"
				},
				
				// Debug settings
				debug: false
			});
      
		};
		
		Event.observe(window, 'load', init_swfupload);
</script>
